package ControlLayer;

import ModelLayer.*;
import java.util.ArrayList;


/**
 * Write a description of class LendCtr here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class LendCtr
{
    // instance variables - replace the example below with your own
    private LendCon lCon;
    private DVDCtr dvdCtr;
    private AddressCtr addrCtr;
    
    public LendCtr()
    {
        lCon = LendCon.getInstance();
    }
    
    public void createLend(int personID, int dvdID, int copyID, String periode, String dato)
    {
        Lending l = new Lending(personID, dvdID, copyID, periode, dato);
        lCon.addLend(l);
    }
    
    public boolean returnLend(int dvdID, int copyID)
    {
        return lCon.deleteLend(dvdID, copyID);
    }
    
    public DVD getDVD(int id)
    {
        return dvdCtr.findDVD(id);
    }
    
    public Copy getCopy(int index, int index2)
    {
        return dvdCtr.getDVD(index).getCopy(index2);
    }
    
    public Person getPerson(int index)
    {
        return addrCtr.getPerson(index);
    }
    
    public ArrayList listAllLends()
    {
        return lCon.getArrayList();
    }
    
    public Lending getLend(int index)
    {
        return lCon.getLend(index);
    }
}
